Shader "Level4/normalOutline"{
	Properties{
		_OutlineColor("Outline Color",color) = (1,1,0,0)
		_OutlineWidth("Outline width",Range(0.002,1)) = 0.01
	}
	
	CGINCLUDE
	
	
	struct appdata{
		float4 vertex:POSITION;
		float3 normal:NORMAL;
	};
	
	struct v2f{
		float4 pos:POSITION;
		float4 color:COLOR;
		float fog:FOGC;
	};
	
	float4 _OutlineColor;
	float _OutlineWidth;
	
	v2f vert(appdata v){
		v2f o;
		o.pos = mul(UNITY_MATRIX_MVP,v.vertex);
		float3 norm = mul((float3x3)UNITY_MATRIX_MVP,v.normal);
		o.pos.xy += norm.xy * _OutlineWidth;
		
		o.color = _OutlineColor;
		
		return o;
	}
	
	float4 frag(v2f v):COLOR{
		return v.color;
	}
	
	ENDCG
	
	SubShader{
		Tags{"Queue"="Transparent"}
		
		Pass{
			Name "Outline"
			Tags{"LightMode"="Always"}
			CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
			#pragma vertex vert
			ENDCG
			Cull back
			ZWrite Off
			Blend SrcAlpha OneMinusSrcAlpha
		}
	}
}